﻿<%@ Page Language="C#" uiculture="auto" %>
<%@ Import Namespace="System.Threading" %>
<%@ Import Namespace="System.Globalization" %>
<script runat="server">
protected override void InitializeCulture()
{
    if (Request.Form["ListBox1"] != null)
    {
        String selectedLanguage = Request.Form["ListBox1"];
        UICulture = selectedLanguage ;
        Culture = selectedLanguage ;

        Thread.CurrentThread.CurrentCulture = 
            CultureInfo.CreateSpecificCulture(selectedLanguage);
        Thread.CurrentThread.CurrentUICulture = new 
            CultureInfo(selectedLanguage);
    }
    base.InitializeCulture();
}
</script>
<html>
<head></head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ListBox ID="ListBox1" runat="server">
            <asp:ListItem Value="en-US" 
                Selected="True">English</asp:ListItem>
            <asp:ListItem Value="es-MX">Español</asp:ListItem>
            <asp:ListItem Value="de-DE">Deutsch</asp:ListItem>
        </asp:ListBox><br />
        <asp:Button ID="Button1" runat="server" 
            Text="Set Language" 
            meta:resourcekey="Button1" />
        <br />
        <asp:Label ID="Label1" runat="server" 
            Text="" 
            meta:resourcekey="Label1" />
        </div>
    </form>
</body>
</html>